import { LogFactory, Logger, LogFactoryBase } from "../common/log";

LogFactory.inst().init(process.cwd()+"/logs/", "log");

class Monster{
    log:Logger = LogFactory.inst().getLogger("Monster"); 
    constructor(){
        this.log.info("Monster construtor ok!");
    }
}

class BigMonster extends Monster{
    log:Logger = LogFactory.inst().getLogger("BigMonster"); 
    constructor(){
        super()
        this.log.info("BigMonster construtor ok!");
    }
}

let monster = new Monster();
let bigMonster = new BigMonster();

class BattleLogFactory extends LogFactoryBase{
    getInitCategory(): string {
        return "battle";
    }
}
BattleLogFactory.inst().init(process.cwd()+"/logs/battlelog/", "store");

class CainiaoBattle {
    log:Logger = LogFactory.inst().getLogger("CainiaoBattle"); 
    battleLog:Logger = BattleLogFactory.inst().getLogger("cainiao"); 

    constructor(){
        this.log.info("CainiaoBattle create at ", new Date().getTime());
    }

    saveLog(){
        this.battleLog.info("log had some error");
    }
}

let b = new CainiaoBattle();
b.saveLog();